<template>
  <el-aside width="220px" class="sidebar">
    <div class="logo">Art Design Pro</div>

    <el-menu
      :default-active="$route.path"
      router
      background-color="#001529"
      text-color="#bbb"
      active-text-color="#fff"
    >
      <!-- 仪表盘（折叠子菜单） -->
      <el-sub-menu index="dashboard">
        <template #title>
          <el-icon><PieChart /></el-icon>
          <span>仪表盘</span>
        </template>

        <el-menu-item index="/dashboard/overview" class="sp2">
          <el-icon><House /></el-icon>
          <span>总览</span>
        </el-menu-item>

        <el-menu-item index="/dashboard/workbench">
          <el-icon><Setting /></el-icon>
          <span>工作台</span>
        </el-menu-item>

        <el-menu-item index="/dashboard/analysis">
          <el-icon><TrendCharts /></el-icon>
          <span>分析页</span>
        </el-menu-item>
      </el-sub-menu>

      <!-- 其余一级菜单 -->
      <el-menu-item index="/articles">
        <el-icon><Document /></el-icon>
        <span>文章管理</span>
      </el-menu-item>

      <el-menu-item index="/templates">
        <el-icon><Menu /></el-icon>
        <span>模板中心</span>
      </el-menu-item>

      <el-menu-item index="/components">
        <el-icon><Operation /></el-icon>
        <span>组件中心</span>
      </el-menu-item>

      <el-menu-item index="/demo">
        <el-icon><SetUp /></el-icon>
        <span>功能演示</span>
      </el-menu-item>

      <el-menu-item index="/system">
        <el-icon><Tools /></el-icon>
        <span>系统管理</span>
      </el-menu-item>

      <el-menu-item index="/results">
        <el-icon><CircleCheck /></el-icon>
        <span>结果页面</span>
      </el-menu-item>

      <el-menu-item index="/users">
        <el-icon><User /></el-icon>
        <span>用户管理</span>
      </el-menu-item>
    </el-menu>
  </el-aside>
  <!-- 侧边栏底部用户信息 -->
<div class="user-info">
  <el-avatar
    size="40"
    src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
  />
  <div class="text">
    <div class="nickname">Admin</div>
    <div class="email">art.design@gmail.com</div>
  </div>
</div>
</template>

<script setup>
import {
  PieChart, House, Setting, TrendCharts,
  Document, Menu, Operation, SetUp, Tools, CircleCheck, User
} from '@element-plus/icons-vue'
</script>

<style scoped>
.user-info {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 186px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #333;
  margin-left: 10px;
}
.nickname {
  font-size: 14px;
  color: #fff;
}
.email {
  font-size: 12px;
  color: #bbb;
}
.sidebar {
  background: #001529;
}
.logo {
  height: 60px;
  line-height: 60px;
  color: #fff;
  text-align: center;
  font-weight: bold;
}
.el-menu {
  border-right: none;
}
.sp2 span{
  padding-left: 12px;
}
</style>